package com.geekhalo.domainevent.v4;

import com.geekhalo.domainevent.service.SMSService;
import com.geekhalo.domainevent.service.SendSMSCommand;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@RocketMQMessageListener(topic = "order-service-topic", consumerGroup = "sms-send-group")
public class SMSConsumer implements RocketMQListener<MessageExt> {

    @Autowired
    private SMSService smsService;

    @Override
    public void onMessage(MessageExt message) {
        SendSMSCommand sendSMSCommand = buildSendSMSCommand...
        this.smsService.send(sendSMSCommand);
    }
}
